package test.h0820;

import java.util.LinkedList;
import java.util.Scanner;

public class Main1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String res = getRes(s);
        System.out.println(res);
    }

    private static String getRes(String s) {
        LinkedList<Character> stack = new LinkedList<>();

        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (stack.isEmpty() && c == '<') {
                ;
            } else if (!stack.isEmpty()&& c == '<'){
                stack.removeLast();
            }else {
                stack.addLast(c);
            }
        }
        StringBuilder ans = new StringBuilder();
        while (!stack.isEmpty()) {
            ans.append(stack.removeFirst());
        }

        String res = ans.toString();
        return res +","+ isValid(res);
    }

    private static boolean isValid(String string) {
        if (string.length() < 8) {
            return false;
        }
        int countUpper = 0;
        int countLower = 0;
        int countDigit = 0;
        int others = 0;
        for (int i = 0; i < string.length(); i++) {
            char c = string.charAt(i);
            if (Character.isUpperCase(c)) {
                countUpper++;
            } else if (Character.isLowerCase(c)) {
                countLower++;
            } else if (Character.isDigit(c)) {
                countDigit++;
            } else if (!Character.isWhitespace(c)) {
                others++;
            }
        }
        return countUpper > 0 && countLower > 0 && countDigit > 0 && others > 0;
    }
}
